#pragma once
#include "renderer.h"
#include "thread.h"
#include <vector>
#include <windows.h>
#include <gl/gl.h>

namespace krryn{
namespace system{
	class opengl_context_pool;
	class renderer_opengl : public renderer{
	public:
		renderer_opengl(opengl_context_pool *a_Pool);
		virtual ~renderer_opengl();

		virtual void begin();
		virtual void draw();
		virtual void end();

		virtual void flush();
	private:
		void clear_buffers();

		float m_R;
		volatile LONG m_Current;
		LONG m_First, m_Count;


		std::vector<GLuint> m_Lists;
		core::mutex m_Guard;
		opengl_context_pool *m_Pool;
	};
}
}